<template>
	<view style="display: flex;align-items: center;justify-content: center;width: 100%;height: 100vh;">
		登陆中...
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ulid: null
			}
		},
		onLoad(options) {
			// 感谢网友 Nahida 贡献以下代码
			// 有问题联系微信 Naruto1986519
			let ulid = options.scene;
			this.ulid = ulid;
			let _this = this
			uni.login({
				success: async (res) => {
					let wechatCode = res.code;
					if (wechatCode) {
						this.$_Request(
							"POST", "/api/wechat-login/mini-program/oauth-website", {
								"code": wechatCode,
								"ulid": ulid,
							},
							(res) => {
								if (res.data.code == 0) {
									uni.switchTab({
										url:"/pages/index/index"
									})
								} else {
									uni.showToast({
										title: res.data.message,
										icon: "none",
										duration: 1000
									});
								}
							}
						)
					} else {
						uni.showToast({
							title: res.errMsg,
							icon: "none",
							duration: 1000
						});
					}
				}
			})
		},
		methods: {

		}
	}
</script>

<style>

</style>